package com.service.impl;

import com.dao.NewsDao;
import com.dao.impl.NewsDaoimpl;
import com.entity.News;
import com.service.NewService;

import java.util.List;
import java.util.Map;

public class NewsServiceImpl implements NewService {
    NewsDao newsDao = new NewsDaoimpl();
    @Override
    public List<News> selectDate(int pageIndex, int pageSize) {
        List<News> list = newsDao.selectDate(pageIndex,pageSize);
        return list;
    }

    @Override
    public News blogDetails(int id) {
        News news = newsDao.blogDetails(id);
        return news;
    }

    @Override
    public List<News> recentPosts() {
        List<News> newsList = newsDao.recentPosts();
        return newsList;
    }

    @Override
    public int getPageCount(int pageSize) {
        int pageCount=0;
        int count = newsDao.getCount();
        pageCount = (count-1)/pageSize+1;
        return pageCount;
    }

    @Override
    public List<Map<String, Object>> getComment(Integer id) {
        return null;
    }


}
